package com.xy.edumap.controller.api;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.xy.edumap.pojo.ResStore;
import com.xy.edumap.service.ResStoreService;

@Api(value = "store", description = "机构接口")
@Controller
public class ResStoreController {

	private static final Log log = LogFactory.getLog(ResStoreController.class);

	@Autowired
	private ResStoreService resService;

	@ApiOperation(value = "测试接口接口", notes = "测试接口测试接口接口", httpMethod = "GET")
	@RequestMapping(value = "/test", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
	@ResponseBody
	public void getIndex() {
		ResStore record = new ResStore();
		record.setStoreName("咋回事");
		int reslut = resService.insert(record);
		log.info("---------------" + reslut);
	}

	@ApiOperation(value = "获取机构列表", notes = "", httpMethod = "GET")
	@RequestMapping(value = "/getStore", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
	@ResponseBody
	public List<ResStore> getStore() {
		List<ResStore> reslut = resService.selectAll();
		log.info("---------------" + reslut.size());
		return reslut;
	}

}
